<?php


abstract class BaseSynthesis extends BaseObject  implements Persistent {


	
	protected static $peer;


	
	protected $id;


	
	protected $member_id;


	
	protected $smithing;


	
	protected $clothcraft;


	
	protected $alchemy;


	
	protected $woodworking;


	
	protected $goldsmithing;


	
	protected $lethercraft;


	
	protected $borncraft;


	
	protected $fishing;


	
	protected $cooking;


	
	protected $synergy;

	
	protected $alreadyInSave = false;

	
	protected $alreadyInValidation = false;

	
	public function getId()
	{

		return $this->id;
	}

	
	public function getMemberId()
	{

		return $this->member_id;
	}

	
	public function getSmithing()
	{

		return $this->smithing;
	}

	
	public function getClothcraft()
	{

		return $this->clothcraft;
	}

	
	public function getAlchemy()
	{

		return $this->alchemy;
	}

	
	public function getWoodworking()
	{

		return $this->woodworking;
	}

	
	public function getGoldsmithing()
	{

		return $this->goldsmithing;
	}

	
	public function getLethercraft()
	{

		return $this->lethercraft;
	}

	
	public function getBorncraft()
	{

		return $this->borncraft;
	}

	
	public function getFishing()
	{

		return $this->fishing;
	}

	
	public function getCooking()
	{

		return $this->cooking;
	}

	
	public function getSynergy()
	{

		return $this->synergy;
	}

	
	public function setId($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->id !== $v) {
			$this->id = $v;
			$this->modifiedColumns[] = SynthesisPeer::ID;
		}

	} 
	
	public function setMemberId($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->member_id !== $v) {
			$this->member_id = $v;
			$this->modifiedColumns[] = SynthesisPeer::MEMBER_ID;
		}

	} 
	
	public function setSmithing($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->smithing !== $v) {
			$this->smithing = $v;
			$this->modifiedColumns[] = SynthesisPeer::SMITHING;
		}

	} 
	
	public function setClothcraft($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->clothcraft !== $v) {
			$this->clothcraft = $v;
			$this->modifiedColumns[] = SynthesisPeer::CLOTHCRAFT;
		}

	} 
	
	public function setAlchemy($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->alchemy !== $v) {
			$this->alchemy = $v;
			$this->modifiedColumns[] = SynthesisPeer::ALCHEMY;
		}

	} 
	
	public function setWoodworking($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->woodworking !== $v) {
			$this->woodworking = $v;
			$this->modifiedColumns[] = SynthesisPeer::WOODWORKING;
		}

	} 
	
	public function setGoldsmithing($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->goldsmithing !== $v) {
			$this->goldsmithing = $v;
			$this->modifiedColumns[] = SynthesisPeer::GOLDSMITHING;
		}

	} 
	
	public function setLethercraft($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->lethercraft !== $v) {
			$this->lethercraft = $v;
			$this->modifiedColumns[] = SynthesisPeer::LETHERCRAFT;
		}

	} 
	
	public function setBorncraft($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->borncraft !== $v) {
			$this->borncraft = $v;
			$this->modifiedColumns[] = SynthesisPeer::BORNCRAFT;
		}

	} 
	
	public function setFishing($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->fishing !== $v) {
			$this->fishing = $v;
			$this->modifiedColumns[] = SynthesisPeer::FISHING;
		}

	} 
	
	public function setCooking($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->cooking !== $v) {
			$this->cooking = $v;
			$this->modifiedColumns[] = SynthesisPeer::COOKING;
		}

	} 
	
	public function setSynergy($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->synergy !== $v) {
			$this->synergy = $v;
			$this->modifiedColumns[] = SynthesisPeer::SYNERGY;
		}

	} 
	
	public function hydrate(ResultSet $rs, $startcol = 1)
	{
		try {

			$this->id = $rs->getInt($startcol + 0);

			$this->member_id = $rs->getInt($startcol + 1);

			$this->smithing = $rs->getString($startcol + 2);

			$this->clothcraft = $rs->getString($startcol + 3);

			$this->alchemy = $rs->getString($startcol + 4);

			$this->woodworking = $rs->getString($startcol + 5);

			$this->goldsmithing = $rs->getString($startcol + 6);

			$this->lethercraft = $rs->getString($startcol + 7);

			$this->borncraft = $rs->getString($startcol + 8);

			$this->fishing = $rs->getString($startcol + 9);

			$this->cooking = $rs->getString($startcol + 10);

			$this->synergy = $rs->getString($startcol + 11);

			$this->resetModified();

			$this->setNew(false);

						return $startcol + 12; 
		} catch (Exception $e) {
			throw new PropelException("Error populating Synthesis object", $e);
		}
	}

	
	public function delete($con = null)
	{
		if ($this->isDeleted()) {
			throw new PropelException("This object has already been deleted.");
		}

		if ($con === null) {
			$con = Propel::getConnection(SynthesisPeer::DATABASE_NAME);
		}

		try {
			$con->begin();
			SynthesisPeer::doDelete($this, $con);
			$this->setDeleted(true);
			$con->commit();
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	
	public function save($con = null)
	{
		if ($this->isDeleted()) {
			throw new PropelException("You cannot save an object that has been deleted.");
		}

		if ($con === null) {
			$con = Propel::getConnection(SynthesisPeer::DATABASE_NAME);
		}

		try {
			$con->begin();
			$affectedRows = $this->doSave($con);
			$con->commit();
			return $affectedRows;
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	
	protected function doSave($con)
	{
		$affectedRows = 0; 		if (!$this->alreadyInSave) {
			$this->alreadyInSave = true;


						if ($this->isModified()) {
				if ($this->isNew()) {
					$pk = SynthesisPeer::doInsert($this, $con);
					$affectedRows += 1; 										 										 
					$this->setId($pk);  
					$this->setNew(false);
				} else {
					$affectedRows += SynthesisPeer::doUpdate($this, $con);
				}
				$this->resetModified(); 			}

			$this->alreadyInSave = false;
		}
		return $affectedRows;
	} 
	
	protected $validationFailures = array();

	
	public function getValidationFailures()
	{
		return $this->validationFailures;
	}

	
	public function validate($columns = null)
	{
		$res = $this->doValidate($columns);
		if ($res === true) {
			$this->validationFailures = array();
			return true;
		} else {
			$this->validationFailures = $res;
			return false;
		}
	}

	
	protected function doValidate($columns = null)
	{
		if (!$this->alreadyInValidation) {
			$this->alreadyInValidation = true;
			$retval = null;

			$failureMap = array();


			if (($retval = SynthesisPeer::doValidate($this, $columns)) !== true) {
				$failureMap = array_merge($failureMap, $retval);
			}



			$this->alreadyInValidation = false;
		}

		return (!empty($failureMap) ? $failureMap : true);
	}

	
	public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = SynthesisPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		return $this->getByPosition($pos);
	}

	
	public function getByPosition($pos)
	{
		switch($pos) {
			case 0:
				return $this->getId();
				break;
			case 1:
				return $this->getMemberId();
				break;
			case 2:
				return $this->getSmithing();
				break;
			case 3:
				return $this->getClothcraft();
				break;
			case 4:
				return $this->getAlchemy();
				break;
			case 5:
				return $this->getWoodworking();
				break;
			case 6:
				return $this->getGoldsmithing();
				break;
			case 7:
				return $this->getLethercraft();
				break;
			case 8:
				return $this->getBorncraft();
				break;
			case 9:
				return $this->getFishing();
				break;
			case 10:
				return $this->getCooking();
				break;
			case 11:
				return $this->getSynergy();
				break;
			default:
				return null;
				break;
		} 	}

	
	public function toArray($keyType = BasePeer::TYPE_PHPNAME)
	{
		$keys = SynthesisPeer::getFieldNames($keyType);
		$result = array(
			$keys[0] => $this->getId(),
			$keys[1] => $this->getMemberId(),
			$keys[2] => $this->getSmithing(),
			$keys[3] => $this->getClothcraft(),
			$keys[4] => $this->getAlchemy(),
			$keys[5] => $this->getWoodworking(),
			$keys[6] => $this->getGoldsmithing(),
			$keys[7] => $this->getLethercraft(),
			$keys[8] => $this->getBorncraft(),
			$keys[9] => $this->getFishing(),
			$keys[10] => $this->getCooking(),
			$keys[11] => $this->getSynergy(),
		);
		return $result;
	}

	
	public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = SynthesisPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		return $this->setByPosition($pos, $value);
	}

	
	public function setByPosition($pos, $value)
	{
		switch($pos) {
			case 0:
				$this->setId($value);
				break;
			case 1:
				$this->setMemberId($value);
				break;
			case 2:
				$this->setSmithing($value);
				break;
			case 3:
				$this->setClothcraft($value);
				break;
			case 4:
				$this->setAlchemy($value);
				break;
			case 5:
				$this->setWoodworking($value);
				break;
			case 6:
				$this->setGoldsmithing($value);
				break;
			case 7:
				$this->setLethercraft($value);
				break;
			case 8:
				$this->setBorncraft($value);
				break;
			case 9:
				$this->setFishing($value);
				break;
			case 10:
				$this->setCooking($value);
				break;
			case 11:
				$this->setSynergy($value);
				break;
		} 	}

	
	public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
	{
		$keys = SynthesisPeer::getFieldNames($keyType);

		if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
		if (array_key_exists($keys[1], $arr)) $this->setMemberId($arr[$keys[1]]);
		if (array_key_exists($keys[2], $arr)) $this->setSmithing($arr[$keys[2]]);
		if (array_key_exists($keys[3], $arr)) $this->setClothcraft($arr[$keys[3]]);
		if (array_key_exists($keys[4], $arr)) $this->setAlchemy($arr[$keys[4]]);
		if (array_key_exists($keys[5], $arr)) $this->setWoodworking($arr[$keys[5]]);
		if (array_key_exists($keys[6], $arr)) $this->setGoldsmithing($arr[$keys[6]]);
		if (array_key_exists($keys[7], $arr)) $this->setLethercraft($arr[$keys[7]]);
		if (array_key_exists($keys[8], $arr)) $this->setBorncraft($arr[$keys[8]]);
		if (array_key_exists($keys[9], $arr)) $this->setFishing($arr[$keys[9]]);
		if (array_key_exists($keys[10], $arr)) $this->setCooking($arr[$keys[10]]);
		if (array_key_exists($keys[11], $arr)) $this->setSynergy($arr[$keys[11]]);
	}

	
	public function buildCriteria()
	{
		$criteria = new Criteria(SynthesisPeer::DATABASE_NAME);

		if ($this->isColumnModified(SynthesisPeer::ID)) $criteria->add(SynthesisPeer::ID, $this->id);
		if ($this->isColumnModified(SynthesisPeer::MEMBER_ID)) $criteria->add(SynthesisPeer::MEMBER_ID, $this->member_id);
		if ($this->isColumnModified(SynthesisPeer::SMITHING)) $criteria->add(SynthesisPeer::SMITHING, $this->smithing);
		if ($this->isColumnModified(SynthesisPeer::CLOTHCRAFT)) $criteria->add(SynthesisPeer::CLOTHCRAFT, $this->clothcraft);
		if ($this->isColumnModified(SynthesisPeer::ALCHEMY)) $criteria->add(SynthesisPeer::ALCHEMY, $this->alchemy);
		if ($this->isColumnModified(SynthesisPeer::WOODWORKING)) $criteria->add(SynthesisPeer::WOODWORKING, $this->woodworking);
		if ($this->isColumnModified(SynthesisPeer::GOLDSMITHING)) $criteria->add(SynthesisPeer::GOLDSMITHING, $this->goldsmithing);
		if ($this->isColumnModified(SynthesisPeer::LETHERCRAFT)) $criteria->add(SynthesisPeer::LETHERCRAFT, $this->lethercraft);
		if ($this->isColumnModified(SynthesisPeer::BORNCRAFT)) $criteria->add(SynthesisPeer::BORNCRAFT, $this->borncraft);
		if ($this->isColumnModified(SynthesisPeer::FISHING)) $criteria->add(SynthesisPeer::FISHING, $this->fishing);
		if ($this->isColumnModified(SynthesisPeer::COOKING)) $criteria->add(SynthesisPeer::COOKING, $this->cooking);
		if ($this->isColumnModified(SynthesisPeer::SYNERGY)) $criteria->add(SynthesisPeer::SYNERGY, $this->synergy);

		return $criteria;
	}

	
	public function buildPkeyCriteria()
	{
		$criteria = new Criteria(SynthesisPeer::DATABASE_NAME);

		$criteria->add(SynthesisPeer::ID, $this->id);

		return $criteria;
	}

	
	public function getPrimaryKey()
	{
		return $this->getId();
	}

	
	public function setPrimaryKey($key)
	{
		$this->setId($key);
	}

	
	public function copyInto($copyObj, $deepCopy = false)
	{

		$copyObj->setMemberId($this->member_id);

		$copyObj->setSmithing($this->smithing);

		$copyObj->setClothcraft($this->clothcraft);

		$copyObj->setAlchemy($this->alchemy);

		$copyObj->setWoodworking($this->woodworking);

		$copyObj->setGoldsmithing($this->goldsmithing);

		$copyObj->setLethercraft($this->lethercraft);

		$copyObj->setBorncraft($this->borncraft);

		$copyObj->setFishing($this->fishing);

		$copyObj->setCooking($this->cooking);

		$copyObj->setSynergy($this->synergy);


		$copyObj->setNew(true);

		$copyObj->setId(NULL); 
	}

	
	public function copy($deepCopy = false)
	{
				$clazz = get_class($this);
		$copyObj = new $clazz();
		$this->copyInto($copyObj, $deepCopy);
		return $copyObj;
	}

	
	public function getPeer()
	{
		if (self::$peer === null) {
			self::$peer = new SynthesisPeer();
		}
		return self::$peer;
	}

} 